package com.xxl.job.executor.service;

import com.xxl.job.executor.model.XxlJobLog;

import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * 脚本接口
 * @author xie xin
 * @date 2025/1/11 00:23
 */
public abstract class ScriptBase implements Runnable {
    public static final String[] SCRIPT_NAME_ARRAY = {"get_log_script","xx"};
    public static ScriptBase getScript(XxlJobLog xxlJobLog) throws Exception {
        String scriptName = xxlJobLog.getScriptName();
        switch (scriptName) {
            case "获取日志脚本":return new GetLogScriptServiceImpl(xxlJobLog);
            default:
                throw new Exception("脚本匹配失败！");
        }
    }
    /**
     * 脚本参数
     */
    public XxlJobLog xxlJobLog;

    /**
     * 执行脚本
     */
    abstract void executeScript();
    @Override
    public void run() {
        executeScript();
    }
}
